package leetcode100;

import java.util.ArrayList;
import java.util.Iterator;

public class lc009 {

    public static void main(String[] args) {
        int n = 45;
        int res = climbStairs(n);
        System.out.println("res:" + res);
    }

    public static int climbStairs(int n) {
        if(n==1) return 1;
        if(n==2) return 2;

        int prePre = 1;
        int pre = 2;
        int cur = 0;
        for(int i=3;i<=n;i++) {
            cur = prePre+pre;
            prePre = pre;
            pre = cur;
        }
        return cur;
    }
}
